import java.util.Timer;
import java.util.TimerTask;

public class ThreadDemo15 {
    public static void main(String[] args) {
        Timer timer =new Timer();
        //使用匿名内部类创建TimerTask
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("hello");
            }
            //定时3s后执行此代码
        },3000);
    }
}
